<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>图片上传</title>
<link href="__PUBLIC__/bootstrap/css/bootstrap.css" rel="stylesheet">
<script src="__PUBLIC__/js/jquery.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/plugins/uploadify/uploadify.css">
<script src="__PUBLIC__/plugins/uploadify/jquery.uploadify.min.js"></script>   
<script type="text/javascript">
 var domainURL = "__ROOT__";
 var publicurl = "__PUBLIC__";
$(function () {
  $("#picUpload").uploadify({
    formData      : {'dir':'pic','width':150,'height':150},
    buttonText    : '选择商品图片',
    fileTypeDesc  : 'Image Files',
      fileTypeExts  : '*.gif; *.jpg; *.png',
      swf           : publicurl+'/plugins/uploadify/uploadify.swf',
      uploader      : domainURL +'/index.php/Home/Index/uploadPic',
      onUploadSuccess : function(file, data, response) {
        json=$.parseJSON(data);
        if(json.status && json.status==1){
          $('#imgPreview').attr('src',domainURL +'/'+ json.Filedata.savepath+json.Filedata.savethumbname).show();
          $('#pic').val(json.Filedata.savepath+json.Filedata.savename);
          $('#pic_thumbs').val(json.Filedata.savepath+json.Filedata.savethumbname); //缩略图，后台配置
        }
      }
  });
});
</script>
<style type="text/css">
  #myform table{min-width:600px;width:60%;}
  .formInput{display:inline-block;}
  #btn button{margin-left: 160px}
  #mybtn {padding: 20px}
  #mybtn #btn2{margin-left: 20px}
</style>
</head>
<body>
<div id="mybtn"><button class="btn btn-info">单图片上传</button><button class="btn btn-default" onclick="javascript:location.href='__ROOT__/index.php/Home/Index/multiPics'" id="btn2">多图片上传</button></div>
<div class='wst-tbar' style="height:50px;padding-left: 10px">
<form  id="myform" method="post" action="#" enctype="multipart/form-data">
    <table class="table table-striped  table-hover">
      <tbody>
      <tr>
        <td colspan="2">
          <!-- <img id='goodsImgPreview0' src='<if condition="$object['goods_out_pic'] =='' ">__ROOT__/Apps/Admin/View/images/store_default_sign.png<else/>__ROOT__/{$object['goods_out_pic']}</if>' width='160' height='160'/><br/> -->
          <img id='imgPreview' src='__PUBLIC__/img/default.png' width='160' height='160'/>
          <input type='text' id='picUpload' />
        </td>
      </tr>
      <tr><td style="width:180px">上传完获取图片的路径：</td><td><input type='text' id='pic' class="form-control formInput" value="" /></td></tr>
      <tr><td style="width:180px">上传完获取缩略图片的路径：</td><td><input type='text' class="form-control formInput" id='pic_thumbs'  value="" /></td></tr>
       <tr id="btn"><td colspan="2"><button class="btn btn-danger" type="submit">保&nbsp;存</button><button type="button" class="btn btn-primary">返&nbsp;回</button></td></tr>
      </tbody>
    </table>
</form>
</div>

</body>
</html>   